from . import db
from sqlalchemy.dialects.mysql import INTEGER
class Mem(db.Model):
    __tablename__ = 'mem'
    id = db.Column(INTEGER(unsigned=True), primary_key=True, autoincrement=True)
    metric_name = db.Column(db.String(255), nullable=False)
    value = db.Column(db.Numeric(30, 10), nullable=False)
    timestamp_value = db.Column(db.DateTime, nullable=False)

    __table_args__ = (
        db.Index('idx_metric_name', 'metric_name'),
        db.Index('idx_timestamp', 'timestamp_value'),
        db.Index('idx_metric_name_timestamp', 'metric_name', 'timestamp_value'),
    )
